package client_cmd;

import java.io.IOException;

import client_entity.User;

public class ChangePassWord_Cmd extends Command{
	private static final int CHANGEPASSWORD = 2;
	
	public ChangePassWord_Cmd(User user)
	{
		super(user);
	}
	
	
	public boolean changePassWord(User user,String old_password,String new_password)
	{
		if(!user.getUser_password().equals(old_password))
		{
			System.out.println("原密码输入错误");
			return false;
		}else{
			try {
				user.setUser_password(new_password);
				connector.send(CHANGEPASSWORD, user);
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return false;
			}
			return (Boolean) connector.recieve();
		}
	}
}
